package com.jt.sp04.feign;

import com.jt.sp01.pojo.Item;
import com.jt.web.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


import java.util.List;

/**
 * 1. 调用哪个服务
 * <p>
 * 2. 调服务的路径
 * 3. 向这个路径提交什么参数
 */
@FeignClient(value = "item-service")
public interface ItemClient {
    @GetMapping("getItems/{orderId}")
    JsonResult<List<Item>> getItems(@PathVariable(value = "orderId") String orderId);

    @PostMapping("decreaseNumbers")
    JsonResult decreaseNumbers(@RequestBody List<Item> list);
}
